package game.model.impl

import game.Config
import game.business.DestroyAble
import game.model.View
import org.itheima.kotlin.game.core.Painter

/**
 * 爆炸物
 */
class Blast(override val x: Int, override val y: Int) : DestroyAble{

    override var width: Int = Config.block
    override var height: Int= Config.block
    private val imagePaths = arrayListOf<String>()
    private var index: Int = 0

    init {
        (1..32).forEach {
            imagePaths.add("img/blast_$it.png")
        }
    }

    override fun draw() {
        val i = index % imagePaths.size
        Painter.drawImage(imagePaths[i],x, y)
        index++;
    }

    override fun isDestroyed(): Boolean {
        return index >= imagePaths.size
    }

}